﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class Volume : OdSiShape, IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public Volume(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(Volume obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~Volume()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_Volume(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		HandleRef OdSiShape.GetCPtr()
		{
			return new HandleRef(this, GlobalsPINVOKE.Volume_OdSiShape_GetCPtr(this.swigCPtr.Handle));
		}

		public virtual OdSiShape clone()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr cPtr = GlobalsPINVOKE.Volume_clone(this.swigCPtr);
			OdSiShapeImpl result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject(new OdSiShapeImpl(cPtr, true));
				result = new OdSiShapeImpl(cPtr, false);
			}
			else
			{
				result = new OdSiShapeImpl(cPtr, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public Volume() : this(GlobalsPINVOKE.new_Volume__SWIG_0(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public Volume(Volume source) : this(GlobalsPINVOKE.new_Volume__SWIG_1(Volume.getCPtr(source)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public Volume(OdGePoint3d origin, OdGeVector3d zAxis, OdGeVector3d yAxis, OdGeVector3d xAxis, double xFov, double yFov, bool xFovAsAspect, bool yFovAsAspect, bool bNearPlane, double fNearPlane, bool bFarPlane, double fFarPlane) : this(GlobalsPINVOKE.new_Volume__SWIG_2(OdGePoint3d.getCPtr(origin), OdGeVector3d.getCPtr(zAxis), OdGeVector3d.getCPtr(yAxis), OdGeVector3d.getCPtr(xAxis), xFov, yFov, xFovAsAspect, yFovAsAspect, bNearPlane, fNearPlane, bFarPlane, fFarPlane), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public Volume(OdGePoint3d origin, OdGeVector3d zAxis, OdGeVector3d yAxis, OdGeVector3d xAxis, double xFov, double yFov, bool xFovAsAspect, bool yFovAsAspect, bool bNearPlane, double fNearPlane, bool bFarPlane) : this(GlobalsPINVOKE.new_Volume__SWIG_3(OdGePoint3d.getCPtr(origin), OdGeVector3d.getCPtr(zAxis), OdGeVector3d.getCPtr(yAxis), OdGeVector3d.getCPtr(xAxis), xFov, yFov, xFovAsAspect, yFovAsAspect, bNearPlane, fNearPlane, bFarPlane), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public Volume(OdGePoint3d origin, OdGeVector3d zAxis, OdGeVector3d yAxis, OdGeVector3d xAxis, double xFov, double yFov, bool xFovAsAspect, bool yFovAsAspect, bool bNearPlane, double fNearPlane) : this(GlobalsPINVOKE.new_Volume__SWIG_4(OdGePoint3d.getCPtr(origin), OdGeVector3d.getCPtr(zAxis), OdGeVector3d.getCPtr(yAxis), OdGeVector3d.getCPtr(xAxis), xFov, yFov, xFovAsAspect, yFovAsAspect, bNearPlane, fNearPlane), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public Volume(OdGePoint3d origin, OdGeVector3d zAxis, OdGeVector3d yAxis, OdGeVector3d xAxis, double xFov, double yFov, bool xFovAsAspect, bool yFovAsAspect, bool bNearPlane) : this(GlobalsPINVOKE.new_Volume__SWIG_5(OdGePoint3d.getCPtr(origin), OdGeVector3d.getCPtr(zAxis), OdGeVector3d.getCPtr(yAxis), OdGeVector3d.getCPtr(xAxis), xFov, yFov, xFovAsAspect, yFovAsAspect, bNearPlane), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public Volume(OdGePoint3d origin, OdGeVector3d zAxis, OdGeVector3d yAxis, OdGeVector3d xAxis, double xFov, double yFov, bool xFovAsAspect, bool yFovAsAspect) : this(GlobalsPINVOKE.new_Volume__SWIG_6(OdGePoint3d.getCPtr(origin), OdGeVector3d.getCPtr(zAxis), OdGeVector3d.getCPtr(yAxis), OdGeVector3d.getCPtr(xAxis), xFov, yFov, xFovAsAspect, yFovAsAspect), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public Volume(OdGePoint3d origin, OdGeVector3d zAxis, OdGeVector3d yAxis, OdGeVector3d xAxis, double xFov, double yFov, bool xFovAsAspect) : this(GlobalsPINVOKE.new_Volume__SWIG_7(OdGePoint3d.getCPtr(origin), OdGeVector3d.getCPtr(zAxis), OdGeVector3d.getCPtr(yAxis), OdGeVector3d.getCPtr(xAxis), xFov, yFov, xFovAsAspect), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public Volume(OdGePoint3d origin, OdGeVector3d zAxis, OdGeVector3d yAxis, OdGeVector3d xAxis, double xFov, double yFov) : this(GlobalsPINVOKE.new_Volume__SWIG_8(OdGePoint3d.getCPtr(origin), OdGeVector3d.getCPtr(zAxis), OdGeVector3d.getCPtr(yAxis), OdGeVector3d.getCPtr(xAxis), xFov, yFov), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual bool contains(OdGeExtents3d extents, bool planar, OdGeTol tol)
		{
			bool result = GlobalsPINVOKE.Volume_contains(this.swigCPtr, OdGeExtents3d.getCPtr(extents), planar, OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool intersects(OdGeExtents3d extents, bool planar, OdGeTol tol)
		{
			bool result = GlobalsPINVOKE.Volume_intersects(this.swigCPtr, OdGeExtents3d.getCPtr(extents), planar, OdGeTol.getCPtr(tol));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void transform(OdGeMatrix3d mtx)
		{
			GlobalsPINVOKE.Volume_transform(this.swigCPtr, OdGeMatrix3d.getCPtr(mtx));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public static double fovToPlane(double fov, double len)
		{
			double result = GlobalsPINVOKE.Volume_fovToPlane(fov, len);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static double fovFromPlane(double plane, double len)
		{
			double result = GlobalsPINVOKE.Volume_fovFromPlane(plane, len);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdSiShape kOverallSpace
		{
			get
			{
				OdSiShapeImpl result = new OdSiShapeImpl(GlobalsPINVOKE.Volume_kOverallSpace_get(), false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
		}

		public static OdSiShape kNoSpace
		{
			get
			{
				OdSiShapeImpl result = new OdSiShapeImpl(GlobalsPINVOKE.Volume_kNoSpace_get(), false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
